/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */

package logging;

import java.util.Date;
import logging.LogLevel.Level;
import wisi.WiSiView;

/**
 *
 * @author marco
 */
class GuiAppender extends IAppender{
    private ErrorPanel panel;

    public GuiAppender() {
    }

    @Override
    public void configure() {
        panel = WiSiView.getErrorPanel();
    }

    @Override
    public void write(Level level, String msg, Exception ex) {
        panel.getTextField().append(Logger.getDateFormat().format(new Date()) + " " + level.toString() + " " + msg + " " + ex.getMessage() + "\n");
    }

    @Override
    public String toString() {
        return "GuiLogLevel";
    }

    @Override
    public void write(Level level, String msg) {
            panel.getTextField().setText(msg);


    }

}
